﻿<AutoComplete @bind-Value="@value"
              OptionDataItems="@options"
              Backfill="@switchBackfill"
              AllowFilter="@allowFilter"
              DefaultActiveFirstOption="@switchDefaultActiveFirstOption"
              Width="120"
              OnPanelVisibleChange="OnPanelVisibleChange"
              Disabled="@disabled" />
<Divider Text="Properties"></Divider>

<div>
    <Switch @bind-Value="switchBackfill" />Backfill
    <br />
    <Switch @bind-Value="switchDefaultActiveFirstOption" />DefaultActiveFirstOption
    <br />
    <Switch @bind-Value="disabled" />Disabled
    <br />
    <Switch @bind-Value="allowFilter" />AllowFilter
</div>

<Divider></Divider>
<span>bind-Value:@value</span>


@code
{
    private string value;

    List<AutoCompleteDataItem<string>> options = new List<AutoCompleteDataItem<string>>() {
        new AutoCompleteDataItem<string>("Burns Bay Road","Burns Bay Road"),
        new AutoCompleteDataItem<string>("Downing Street","Downing Street"){ IsDisabled=true },
        new AutoCompleteDataItem<string>("Wall Street","Wall Street")
        };

    bool switchBackfill { get; set; } = false;

    bool switchDefaultActiveFirstOption { get; set; } = true;

    bool disabled { get; set; } = false;

    bool allowFilter { get; set; } = true;

    private void OnPanelVisibleChange(bool visible)
    {
        Console.WriteLine(visible);
    }
}
